home *** CD-ROM | disk | FTP | other *** search
- Math Libraries (MATHLIB) for Turbo Pascal
- Copyright (c) 1991, Waldman Sidelines
- Harness the Power of the Advanced Coprocessors in Your Programs!
-
- Waldman Sidelines
- Cye H. Waldman
- Post Office Box 231157
- Encinitas, CA 92023-1157
- Tel: (619) 942-3016 : CSERVE 72245,1337
-
-
- INTRODUCTION
-
- MATHLIB offers Turbo Pascal users enhanced math function libraries specifically
- written to tap the power of the 80287 and 80387 coprocessors. All of the
- intrinsic trigonometric and exponential functions plus nine additional ones
- have been hand-coded in assembly language specifically for each coprocessor.
- These nine additional functions were also coded in Pascal for use with any or
- no coprocessor. MATHLIB provides a consistent set of Turbo Pascal units for
- use with any type of PC with improved performance for advanced coprocessors.
-
- MATHLIB should be of particular interest to those performing numerically
- intensive computations such as scientific and engineering calculations and
- graphics applications which require coordinate transformations using
- trigonometric relations.
-
- This program is a shareware product. You may distribute the original shareware
- disk (not including the source code) to your friends for evaluation. If you
- use this program you are expected to register it with Waldman Sidelines.
-
- Your registration fee entitles you to use this software on a single computer
- and to make as many copies of this software as you wish for your own backup
- purposes. Site licenses are available; call for details. You may not use
- MATHLIB in a commercial product; a separate licence agreement must be
- established with Waldman Sidelines.
-
- Upon receipt of your registration you will receive a disk with the Pascal
- source and the assembled object code required to compile the units, as well
- as some bonus software (keep reading). (Contact the author regarding
- availability of the assembly language source code.) In addition, you will
- receive notifications of future software updates.
-
- LIMIT OF LIABILITY
-
- MATHLIB is distributed as-is. The author disclaims all warranties expressed or
- implied. The author will assume no liability for damages either from direct
- use of this product or as a consequence of the use of this product.
-
- COPYRIGHT
-
- MATHLIB is copyrighted with all rights reserved to Waldman Sidelines.
-
- TRADEMARKS
-
- Turbo Pascal is a registered trademark of Borland International, Inc.
- 386MAX is a registered trademark of Qualitas, Inc.
- NetRoom is a trademark of Helix Software Company, Inc.
- Microsoft and MS-DOS are registered trademarks of Microsoft, Inc.
-
- MATHLIB Documentation Page 1
- DESCRIPTION
-
- Three Turbo Pascal 6.0 units (TPU files) are provided with this software. Two
- of these provide faster floating point calculation by directly accessing the
- advanced instruction set of the '287 and '387 coprocessors. (These are not
- accessible to math functions compiled under Turbo Pascal which is limited to
- the 8087 instruction set.) The three units are MathLib (for use on any
- machine, including those without a coprocessor), P287MathLib (for use only
- with a '287 or better coprocessor) and P387MathLib (for use only with a '387
- or better coprocessor). These units are in files MATHLIB.TPU, P287MATH.TPU,
- and P387MATH.TPU, respectively. The units also contain a number of functions
- which are not in the standard library. These functions are coded in Pascal in
- MathLib and in assembly language in P287MathLib and P387MathLib. Units
- P287MathLib and P387MathLib also contain assembly language replacements for
- the intrinsic functions in the System Unit (i.e., ARCTAN, COS, EXP, LN, SIN).
-
- These libraries are intended for users familiar with Turbo Pascal and the use
- of units. Those not familiar with units should refer to the Turbo Pascal
- manuals.
-
- NOTES ON USAGE
-
- 1. Functions supported by all libraries (in alphabetical order):
-
- NOTE: The instrinsic transcendental functions from the Turbo Pascal System
- Unit (i.e., ARCTAN, COS, EXP, LN, SIN) can be of any type and are not
- limited to type DOUBLE. That would be the case in UNIT MathLib.
-
- FUNCTION ArcCOS(x: DOUBLE):DOUBLE; { arc cosine function }
-
- FUNCTION ArcSIN(x: DOUBLE):DOUBLE; { arc sine function }
-
- FUNCTION ARCTAN(x: DOUBLE):DOUBLE; { arc tangent function }
-
- FUNCTION ArcTangent(x,y: DOUBLE):DOUBLE; { optional arc tan function }
- { returns arctan(y/x) in the proper quadrant, e.g., 0-360 degrees }
-
- FUNCTION COS(x:DOUBLE):DOUBLE; { cosine function }
-
- FUNCTION EXP(x:DOUBLE):DOUBLE; { exponential fn, e^x }
-
- FUNCTION Expo(x,y:DOUBLE):DOUBLE; { exponential fn, x^y }
-
- FUNCTION LN(x:DOUBLE):DOUBLE; { natural logarithm function }
-
- FUNCTION LOG(x:DOUBLE):DOUBLE; { common logarithm function }
-
- FUNCTION SIN(x:DOUBLE):DOUBLE; { sine function }
-
- PROCEDURE SINCOS(x:DOUBLE; VAR y,z:DOUBLE); { sine/cosine procedure }
- { returns both sine and cosine; y = SIN(x), z = COS(x) }
-
- FUNCTION TAN(x:DOUBLE):DOUBLE; { tangent function }
-
- FUNCTION Ten2TheX(x:DOUBLE):DOUBLE; { exponential fn, 10^x }
-
- FUNCTION Two2TheX(x:DOUBLE):DOUBLE; { exponential fn, 2^x }
-
- MATHLIB Documentation Page 2
- 2. Libraries are valid only for type DOUBLE. (The author has found type
- DOUBLE to be faster than type REAL.)
-
- 3. Libraries are compiled in Turbo Pascal 6.0 with the /v option. Object
- code is compiled with TASM 2.01 in the IDEAL mode with the TPASCAL MODEL.
-
- 4. Standard USES convention; e.g., USES MathLib or USES P287MathLib or
- USES P387MathLib. (Can't mix 'n' match libraries; use one or the other.)
-
- 5. Install the three TPU files in a directory where Turbo Pascal will find
- them and use them in the normal way. E.g., can be USED in other units.
-
- 6. The advanced libraries (Px87MathLib) automatically supersede the intrinsic
- math functions. No explicit action is required on the part of the user.
-
- 7. Hardware-specific software can be developed by changing a single line of
- code and recompiling. E.g., USES MathLib ==> USES P387MathLib.
-
- 8. These libraries have been in use for about two years in mathematical
- models of physical systems developed by the author. Speed increases of
- up to 40% have been observed in computationally intensive programs.
-
- 9. Until you become familiar with these programs it would be prudent to
- verify that they give the results you expect by comparing output from the
- same program compiled with the basic and advanced units.
-
- 10. Registered users will receive a registration number and all Pascal source
- code and assembled object code. The source and object codes will allow
- compilation to past and future versions of Turbo Pascal without an
- assembler. The registered version does not contain the initialization
- shareware information screen. In addition, you will receive bonus
- software for the Wichmann-Hill random number generator (Byte, March 1987)
- in assembly and a solar/lunar ephemeris unit (both with source code).
-
- 11. Technical support is available on CompuServe at ID 72245,1337.
-
- CUSTOM VERSIONS
-
- Custom versions of the MATHLIB units can be developed for your organization.
- For example, renaming the functions used in Px87MathLib so that the libraries
- can be used concurrently, or addition of new functions hand coded in assembly
- language. Please contact Waldman Sidelines for a quotation.
-
- PERFORMANCE CONSIDERATIONS
-
- The table below shows time trials on a '486/33 (with 386MAX installed) with
- the various libraries. The numbers in the first three columns are the times
- (in seconds) for 100,000 trials with randomly drawn arguments. The numbers
- are approximate because the time for drawing the random numbers is subtracted
- out. Nevertheless, as the ratios show, there is a substantial speed up with
- the custom libraries. Notice the very strong impact of using the intrinsic
- TAN, SIN, and COS functions and SINCOS procedure in the 80387 coprocessor.
- Also, good advantage is taken of the redefinition of the ARCTAN instruction in
- the '387. The libraries were tested extensively for accuracy; a program was
- developed which drew random arguments and compared the results of the various
- libraries. Try the enclosed Savage benchmark (I find the '387 to be 2.4 times
- faster) or make up your own.
-
- MATHLIB Documentation Page 3
- Time for 100,000 Ratio Ratio
- '087 '287 '387 287/087 387/087
- ---------------- ------- -------
- LN: 2.21 1.22 1.21 1.83 1.83
- LOG: 2.77 1.20 1.20 2.31 2.31
- Two2TheX: 5.13 1.86 1.86 2.75 2.75
- EXP: 2.88 1.89 1.89 1.53 1.53
- Ten2TheX: 5.84 1.91 1.91 3.05 3.05
- Expo: 5.47 2.82 2.82 1.94 1.94
- TAN: 6.22 1.37 1.27 3.33 4.91
- SIN: 2.87 2.33 1.27 1.24 2.26
- COS: 2.87 2.40 1.27 1.25 2.26
- SINCOS: 6.04 4.52 1.51 1.34 3.99
- ARCTAN: 2.23 1.48 1.15 1.51 1.93
- ArcTangent: 3.27 1.84 1.38 1.78 2.38
- ARCSIN: 3.25 1.99 1.77 1.63 1.84
- ARCCOS: 4.55 2.05 1.81 2.22 2.52
-
-
- In the course of developing the timing benchmarks it was discovered that the
- presence of a memory manager had a rather significant effect on the
- performance of the intrinsic math functions in Turbo Pascal. The results with
- a memory manager were about 25-40% slower. We found this to be true for three
- memory managers we tested (i.e., 386MAX, NetRoom, and Microsoft MS-DOS 5.0
- HIMEM/EMM386). We reported this anomalous behavior to Borland who were able
- to duplicate this odd result with QEMM as well. Also, there was a great deal
- of variability in the results with the memory managers we tested. In our
- tests, 386MAX was the fastest and Microsoft MS-DOS 5.0 HIMEM/EMM386 was the
- slowest. The question arises as to whether the problem is with Turbo Pascal
- or with the memory managers. To answer that question we developed a similar
- performance test of the intrinsic math functions in Microsoft FORTRAN. The
- memory manager (386MAX, in this case) only slowed down the operations by about
- 2%, which is about what we would expect. This seems to suggest some
- deficiency in Turbo Pascal, but we have no hard core information as yet. The
- good news is that the mathematics functions in the advanced libraries provided
- herein appear to be virtually unaffected by the memory mangers. The table
- below shows the comparisons. Also look at the benchmarks reported in
- SAVAGE.PAS. Please share your own observations with us.
-
- Time for 100,000 Time for 100,000
- Intrinsic Funcs. P387MathLib Func.
- w/out 386MAX with w/out 386MAX with
- ----------------- -----------------
- LN: 1.57 2.21 1.19 1.21
- LOG: 2.15 2.77 1.19 1.20
- Two2TheX: 3.89 5.13 1.86 1.86
- EXP: 2.26 2.88 1.89 1.89
- Ten2TheX: 4.60 5.84 1.91 1.91
- Expo: 4.23 5.47 2.81 2.82
- TAN: 4.98 6.22 1.26 1.27
- SIN: 2.25 2.87 1.27 1.27
- COS: 2.25 2.87 1.27 1.27
- SINCOS: 4.80 6.04 1.51 1.51
- ARCTAN: 1.61 2.23 1.15 1.15
- ArcTangent: 2.66 3.27 1.36 1.38
- ARCSIN: 2.63 3.25 1.77 1.77
- ARCCOS: 3.93 4.55 1.80 1.81
-
- MATHLIB Documentation Page 4
- INVOICE & REGISTRATION FOR MATHLIB VERSION 1.0
-
- Please remit to: Waldman Sidelines
- Cye H. Waldman
- P.O. Box 231157
- Encinitas, CA 92023-1157
-
- LIMIT OF LIABILITY
-
- The MATHLIB libraries (MathLib, Px87MathLib) are distributed as-is.
- The author disclaims all warranties, expressed or implied. The
- author will assume no liability for damages either from the direct
- use of this product or as a consequence of the use of this product.
-
- Please register one copy of MATHLIB for each user at your site.
-
- MATHLIB Registration Qty. _____ @ $25.00 ea. = ____________
-
- Calif. Residents Add 7.25% Sales Tax + ____________
-
- Total Payment: ____________
-
- Registered users will receive a disk with the Pascal source code and
- assembled object code as well as bonus software consisting of a random
- number generator (assembly code) and ephemeris routines for solar and
- lunar zenith/azimuth (Pascal). Registered users will be notified of new
- updates. Suggestions for extensions of the libraries are welcome as
- well as requests for developments of similar libraries for other
- languages. Comments are also welcome from those who elect not to
- register. Thank you for using MATHLIB.
-
- Name: ____________________________________________________________
-
- Company: _________________________________________________________
-
- Address: _________________________________________________________
-
- City, State, Zip: ________________________________________________
-
- Day Phone: _______________________ Eve: ________________________
-
-
- COMMENTS AND SUGGESTIONS
-
- ______________________________________________________________________
-
- ______________________________________________________________________
-
- ______________________________________________________________________
-
- ______________________________________________________________________
-
- ______________________________________________________________________
-
- ______________________________________________________________________
-
- ______________________________________________________________________
-
- ______________________________________________________________________
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- Public (software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. PsL cannot debug pro-
- programs over the telephone, though we can answer questions.
-
- Disks in the PsL are updated monthly, so if you did not get
- this disk directly from the PsL, you should be aware that the
- files in this set may no longer be the current versions. Also,
- if you got this disk from another vendor and are having prob-
- lems, be aware that some files may have become corrupted or
- lost by that vendor. Get a current, working disk from PsL.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 3,000+ disks in the library, call or write
-
- Public (software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
-
- Orders only:
- 1-800-2424-PSL
- MC/Visa/AmEx/Discover
-
- Outside of U.S. or in Texas
- or for general information,
- Call 1-713-524-6394
-
- PsL also has an outstanding
- catalog for the Macintosh.
-
-